/************************************
 * Package: RGcpp					*
 * Authors: Rui Eduardo Gouveia Gil	*
 * Date: 2010						*
 ************************************/
#ifndef __RGCPP_MD5GENERATOR_H__
#define __RGCPP_MD5GENERATOR_H__

#include <openssl/md5.h>

#include "rgcpp/exceptions/RuntimeException.h"

#define MD5_DIGEST_SIZE 16

namespace rgcpp
{

class MD5Generator
{
	private:
		bool state;
		MD5_CTX md5_ctx;

	public:
		MD5Generator();
		~MD5Generator();

		void init();
		void update(const char* data, const unsigned length);
		void digest(char* digest);

		static void digest(const char* data, const unsigned int length, char* digest);
};

}

#endif
